package com.tedu._04mybatis.mapper;

import com.tedu._04mybatis.pojo.Comment;
import com.tedu._04mybatis.pojo.CommentVO1;
import com.tedu._04mybatis.pojo.CommentVO2;
import com.tedu._04mybatis.pojo.Weibo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CommentMapper {

//    @Insert("INSERT INTO comment(content,created,weibo_id,user_id) " +
//            "VALUES (#{content},#{created},#{weiboId},#{userId})")
    int insertComment(Comment comment);

//    @Delete("DELETE FROM comment " +
//            "WHERE id = #{id}")
    int deleteById(Integer id);

//    @Update("UPDATE comment " +
//            "SET content = #{content},created = #{created} " +
//            "WHERE id = #{id}")
    int updateByIdComment(Comment comment);

//    @Select("SELECT content,user_id userId,weibo_id weiboId " +
//            "FROM comment " +
//            "WHERE id=#{id}")
    CommentVO1 selectByIdCommentVO1(Integer id);

//    @Select("SELECT content,user_id userId " +
//            "FROM comment " +
//            "WHERE weibo_id=#{id}")
    List<CommentVO2> selectByIdCommentVO2(Integer id);

    int dynamicUpdate(Comment comment);

    int dynamicDelete(Integer[] ids);

    int dynamicDelete2(List<Integer> ids);
}
